package com.mediacloud.app.newsmodule.activity.microlive;

import android.graphics.Canvas;
import android.graphics.Rect;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;

/**
 * Created by x on 2018/1/23.
 */

public class MicroLiveDivider extends RecyclerView.ItemDecoration
{
    int divierHeight;

    public MicroLiveDivider(int divierHeight)
    {
        this.divierHeight=divierHeight;
    }
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
    {
        if(parent.getChildAdapterPosition(view)==(parent.getAdapter().getItemCount()-1))
            outRect.set(0, 0, 0, 0);
        else
            outRect.set(0, 0, 0, divierHeight);
    }

    @Override
    public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state)
    {
        super.onDraw(c, parent, state);
    }
}